<include file="Public/head"/>
<script src="__PUBLIC__/qwadmin/js/layer/layer.js"></script>
<script src="__PUBLIC__/qwadmin/js/laydate/laydate.js"></script> <!-- 改成你的路径 -->
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="form-inline" style="padding-left: 15px;">
                                <span>按时间段导出：</span>
                                <input id="bg-time" placeholder="开始时间">
                                <span> - </span>
                                <input id="end-time" placeholder="截止时间">
                                <button type="submit" id="export" class="btn btn-purple btn-sm" style="padding-left: 15px;">
                                    导出数据
                                </button>
                            </div>

                        </div>
                        <!-- PAGE CONTENT BEGINS -->
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th class="col-xs-1">姓名</th>
                                <th class="col-xs-1 center">手机号</th>
                                <th class="col-xs-3 center">内容</th>
                                <th class="col-xs-1">类型</th>
                                <th class="col-xs-1">来源</th>
                                <th class="col-xs-1">时间</th>
                                <th class="col-xs-2">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="list" id="val">
                                <tr>
                                    <td>{$val['name']}</td>
                                    <td class="center">{$val['mobile']}</td>
                                    <td class="center">{$val['content']}</td>
                                    <td>{$val['msg_type_n']}</td>
                                    <td>{$val['from']}</td>
                                    <td>
                                        {$val['ctime']}
                                    </td>
                                    <td class="center">
                                        <a href="{:U('edit',array('id'=>$val['id']))}">修改</a>&nbsp;
                                        <a class="del" href="javascript:;" val="{:U('del',array('id'=>$val['id']))}" title="删除">删除</a>
                                    </td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        $(".inputorder").change(function () {
            var id = $(this).attr('val');
            var o = $(this).val();
            if (id != o) {
                $.post("{:U('update',array('act'=>'order'))}", {id: id, o: o}, function (data) {
                    if (data == 1) {
                        window.location.reload(true);
                    }
                }
            )
                ;
            }
        })
        $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除该留言？",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
    });
    laydate.render({
        elem: '#bg-time' //指定元素
    });
    laydate.render({
        elem: '#end-time' //指定元素
    });
    $("#export").on("click",function(){
        var bgtime = $("#bg-time").val();
        var endtime = $("#end-time").val();
        if (bgtime=="") {
            layer.alert('请选择开始时间');
            return false;
        }
        if (endtime=="") {
            layer.alert('请选择结束时间');
            return false;
        }
        var URL="{:U('export')}";
        window.location.href = URL+"?bg="+bgtime+"&end="+endtime;

    });

</script>

</body>
</html>
